package com.umfb.config.zk;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by zcah on 18-4-19.
 */
public class ConstantConfig {

    public final static Map<String, String> UmfbConfig = new HashMap<String, String>();

    private final static String SERVER_ADMIN_DOMAIN = "server.admin";
    private final static String SERVER_API_DOMAIN = "server.api";
    private final static String SERVER_IMAGE_DOMAIN = "server.image";
    private final static String SERVER_MAT_DOMAIN = "server.mat";
    private final static String SERVER_WEB_DOMAIN = "server.web";
    private final static String CONFIG_COOKIE_DOMAIN = "conf.cookie.domain";
    private final static String CONFIG_IMAGE_DOMAIN = "tp.qiniu.bucket_url";
    /**通联支付*/
    private final static String SYB_CUSID = "tp.tlzf.syb_cusid";
    private final static String SYB_APPKEY = "tp.tlzf.syb_appkey";
    private final static String SYB_APPID = "tp.tlzf.syb_appid";
    private final static String SYB_APIURL = "tp.tlzf.syb_apiurl";

    private final static String APP_KEY = "jpush.jiguang.app_key";
    private final static String MASTER_SECRET = "jpush.jiguang.master_secret";
    private final static String APNS_ENVIRONMENT = "jpush.jiguang.apns_environment";

    public final static Map<String, String> JPUSH = new HashMap<String, String>();

    private final static List<Listener> listeners = new ArrayList<Listener>();

    public static void triggerConfigSetComplete() {
        for (Listener listener : listeners) {
            listener.execute(UmfbConfig);
        }
    }

    public static void registerListener(Listener listener) {
        listeners.add(listener);
    }


    public static String domainServerAdmin() {
        return UmfbConfig.get(SERVER_ADMIN_DOMAIN);
    }

    public static String domainServerApi() {
        return UmfbConfig.get(SERVER_API_DOMAIN);
    }


    public static String domainServerImage() {
        return UmfbConfig.get(SERVER_IMAGE_DOMAIN);
    }


    public static String domainServerMat() {
        return UmfbConfig.get(SERVER_MAT_DOMAIN);
    }


    public static String domainServerWeb() {
        return UmfbConfig.get(SERVER_WEB_DOMAIN);
    }


    public static String domainConfigCookie() {
        return UmfbConfig.get(CONFIG_COOKIE_DOMAIN);
    }


    public static String domainConfigImage() {
        return UmfbConfig.get(CONFIG_IMAGE_DOMAIN);
    }

    public static String getSybCusid() {
        return SYB_CUSID;
    }

    public static String getSybAppkey() {
        return SYB_APPKEY;
    }

    public static String getSybAppid() {
        return SYB_APPID;
    }

    public static String getSybApiurl() {
        return SYB_APIURL;
    }

    public static String getAppKey() {
        return JPUSH.get(APP_KEY);
    }

    public static String getMasterSecret() {
        return JPUSH.get(MASTER_SECRET);
    }

    public static String getApnsEnvironment() {
        return JPUSH.get(APNS_ENVIRONMENT);
    }

}
